﻿using System;
using Newtonsoft.Json.Linq;

namespace SourcesUnPacker.role
{
    public class Role
    {
        // Fields
        public readonly int? _Id; // 0x10
        public readonly string _Name; // 0x18
        public readonly int? _Sex; // 0x20
        public readonly int? _InitLiliang; // 0x28
        public readonly int? _InitYizhi; // 0x30
        public readonly int? _InitMinjie; // 0x38
        public readonly int? _InitGengu; // 0x40
        public readonly int? _GrowLiliang; // 0x48
        public readonly int? _GrowYizhi; // 0x50
        public readonly int? _GrowMinjie; // 0x58
        public readonly int? _GrowGengu; // 0x60
        public readonly int? _ResId; // 0x68
        
        public Role(JArray dataArray)
        {
            _Id = dataArray[0].Type != JTokenType.Null ? Convert.ToInt32(dataArray[0]) : (int?)null;
            _Name = dataArray[1].Type != JTokenType.Null ? Convert.ToString(dataArray[1]) : null;
            _Sex=dataArray[1].Type!=JTokenType.Null?Convert.ToInt32(dataArray[2]):(int?)null;
            _InitLiliang=dataArray[3].Type!=JTokenType.Null?Convert.ToInt32(dataArray[3]):(int?)null;
            _InitYizhi=dataArray[4].Type!=JTokenType.Null?Convert.ToInt32(dataArray[4]):(int?)null;
            _InitMinjie=dataArray[5].Type!=JTokenType.Null?Convert.ToInt32(dataArray[5]):(int?)null;
            _InitGengu=dataArray[6].Type!=JTokenType.Null?Convert.ToInt32(dataArray[6]):(int?)null;
            _GrowLiliang=dataArray[7].Type!=JTokenType.Null?Convert.ToInt32(dataArray[7]):(int?)null;
            _GrowYizhi=dataArray[8].Type!=JTokenType.Null?Convert.ToInt32(dataArray[8]):(int?)null;
            _GrowMinjie=dataArray[9].Type!=JTokenType.Null?Convert.ToInt32(dataArray[9]):(int?)null;
            _GrowGengu=dataArray[10].Type!=JTokenType.Null?Convert.ToInt32(dataArray[10]):(int?)null;
            _ResId=dataArray[11].Type!=JTokenType.Null?Convert.ToInt32(dataArray[11]):(int?)null;
        }
        
    }
}